#!/bin/bash

FT='/path/to/fastText/function/fasttext'
RF='/path/to/replication/file'

#Train on partisanship (five folds)
for i in {1..5}; 
do $FT supervised -input $RF/data/indiana_soldiers/cleaned/fastText/data/party_train_f${i} -output $RF/data/indiana_soldiers/cleaned/fastText/models/model_party_f${i} -autotune-validation $RF/data/indiana_soldiers/cleaned/fastText/data/party_test_f${i} -dim 100 -autotune-metric f1 -autotune-duration 300; done

#Predict for out of fold (Test)
for i in {1..5}; 
do $FT predict-prob $RF/data/indiana_soldiers/cleaned/fastText/models/model_party_f${i}.bin $RF/data/indiana_soldiers/cleaned/fastText/data/party_test_f${i} 4 > $RF/data/indiana_soldiers/cleaned/fastText/predict/party_test_f${i}_probs.txt; done

#Predict for veteran matches in 1874 (Validate)
for i in {1..5}; 
do $FT predict-prob $RF/data/indiana_soldiers/cleaned/fastText/models/model_party_f${i}.bin $RF/data/indiana_soldiers/cleaned/fastText/data/party_validate 4 > $RF/data/indiana_soldiers/cleaned/fastText/predict/party_validate_f${i}_probs.txt; done

#Predict for 1860 Census (Predict)
for i in {1..5}; 
do $FT predict-prob $RF/data/indiana_soldiers/cleaned/fastText/models/model_party_f${i}.bin $RF/data/indiana_soldiers/cleaned/fastText/data/party_predict_1860.txt 4 > $RF/data/indiana_soldiers/cleaned/fastText/predict/party_predict_f${i}_probs.txt; done
